package com.yurui.controller;


import com.yurui.entities.CommonResult;
import com.yurui.service.AccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@Slf4j
@RestController
@RequestMapping("account")
public class AccountController {


    private AccountService accountService;

    public AccountController(AccountService accountService) {
        this.accountService = accountService;
    }


    @PostMapping("decrease")
    public CommonResult<String> decrease(Long userId, float money) {
        log.info("调用金额的接口,userId=" + userId);
        accountService.decrease(userId, money);
        return new CommonResult<>("减金额成功");
    }

}
